﻿Imports ccapps.persistent.FinancialTransaction
Public Class FaturaGoruntuleme
    Inherits System.Web.UI.Page
    Dim dt As DataTable
    Dim directory As String
    Dim filename As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim docno As String = ""
        Dim docno2 As String = ""
        Dim ucret As Double
        Dim cstype As DataTable
        'docno = "20030000879808"
        'docno2 = "20140443181889"
        docno = Request.QueryString.Get(0)
        LblIdocno.Text = docno

        Dim dt2 As DataTable = GetCustInfoFromohrefnum(LblIdocno.Text)
        If dt2.Rows.Count > 0 Then
            LblName.Text = dt2.Rows(0)("FNAME").ToString() + "   " + dt2.Rows(0)("LNAME").ToString()
            LblAdres.Text = dt2.Rows(0)("CITY").ToString()
            LblSonOdeme.Text = String.Format("{0:d}", Convert.ToDateTime(dt2.Rows(0)("SonOdeme").ToString()))
       

        End If

        Dim dt4 As DataTable = DisplayInvoiceDetails(LblIdocno.Text, 10)

        Dim index4 As Integer
        If dt4.Rows.Count > 0 Then
            digerucretler.InnerHtml = "<table>"
            For index4 = 0 To dt4.Rows.Count - 1
                Try
                    ucret = Convert.ToDouble(dt4.Rows(index4)("Ucretler").ToString()) - Convert.ToDouble(dt4.Rows(index4)("Indirim").ToString())
                Catch ex As Exception
                    ucret = Convert.ToDouble(dt4.Rows(index4)("Ucretler").ToString())
                End Try
                digerucretler.InnerHtml += "<tr>"
                digerucretler.InnerHtml += "<td class='auto-style21' nowrap>" + dt4.Rows(index4)("Birimler").ToString() + "</td>"
                digerucretler.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + ucret.ToString() + "</td>"
                digerucretler.InnerHtml += "</tr>"
            Next
            digerucretler.InnerHtml += "</table>"
        End If


        Dim dt5 As DataTable = DisplayTax(LblIdocno.Text)

        Dim index5 As Integer
        If dt5.Rows.Count > 0 Then
            devleteodenenvergi.InnerHtml = "<table>"
            For index5 = 0 To dt5.Rows.Count - 1

                devleteodenenvergi.InnerHtml += "<tr>"
                devleteodenenvergi.InnerHtml += "<td class='auto-style21' nowrap>" + dt5.Rows(index5)("NAME").ToString() + "</td>"
                devleteodenenvergi.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + dt5.Rows(index5)("AMOUNT").ToString() + "</td>"
                devleteodenenvergi.InnerHtml += "</tr>"
            Next
            Dim dt6 As DataTable = DisplayTax2(LblIdocno.Text)
            If dt6.Rows.Count > 0 Then
                Dim index6 As Integer
                For index6 = 0 To dt6.Rows.Count - 1
                    devleteodenenvergi.InnerHtml += "<tr>"
                    devleteodenenvergi.InnerHtml += "<td class='auto-style21' nowrap>" + dt6.Rows(index6)("Birimler").ToString() + "</td>"
                    devleteodenenvergi.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + dt6.Rows(index6)("Ucretler").ToString() + "</td>"
                    devleteodenenvergi.InnerHtml += "</tr>"
                Next


            End If


            devleteodenenvergi.InnerHtml += "</table>"
        End If

        Dim dt7 As DataTable = OdenmemisFatura(LblIdocno.Text)
        GridView1.DataSource = dt7
        GridView1.DataBind()

        'Dim dtdirectory As DataTable = FindDirectory(LblIdocno.Text)
        Dim dtdirectory As DataTable = FindDirectory(LblIdocno.Text)
        If dtdirectory.Rows.Count > 0 Then
            Dim path As String = dtdirectory.Rows(0)(0).ToString()
            Dim path2() As String = path.Split("/")
            Dim i As Integer
            Dim j As Integer
            Try
                For i = 0 To path2.Length - 2
                    If i = 0 Then
                        directory += path2(i)
                    Else
                        directory += "/" + path2(i)
                    End If
                    If i = path2.Length - 2 Then
                        directory += "/"
                    End If
                Next
                For j = path2.Length - 2 To path2.Length - 1
                    filename = path2(j)

                Next
                cstype = GetCustomerType(docno)
                If Not cstype.Rows(0)(0).ToString = "CORP" Then
                    printmassInvoiceLayout()
                    'printlaInvoiceLayout()
                Else
                    printlaInvoiceLayout()
                End If
            Catch ex As Exception
                Response.Write(ex.ToString())
            End Try

           
            Else
                Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Dge Output'undan Değer Dönmüyor.');</script>")
            End If

           
       

       

    End Sub
    Sub printmassInvoiceLayout()
        Dim index As Integer
        dt = New DataTable()
        dt = FaturaGoruntule(directory, filename)
        If dt.Rows.Count > 0 Then
            If dt.Rows(0)("c3").ToString() <> "X" Then
                LblMsisdn.Text = dt.Rows(0)("c3").ToString()
            Else
                LblMsisdn.Text = ""

            End If
            If dt.Rows(0)("c2").ToString() <> "X" Then
                lblKulUcret.Text = dt.Rows(0)("c2").ToString()
            End If

            KullanimUcretleri.InnerHtml = "<table>"

            If dt.Rows(0)("c5").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap ><strong>Telefon Görüşmeleri </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c5").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c4").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'>" + dt.Rows(0)("c4").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c6").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Kısa Numara </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c6").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c7").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş) </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c7").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c8").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c8").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c9").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İnternet </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c9").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c10").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>SMS / MMS / Katma Değerli Servisler </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c10").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c11").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c11").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c12").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş)</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c12").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c13").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c13").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c14").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c14").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c15").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21'width='100%' nowrap>Sabit Hat (Ev-İş)</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c15").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c16").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c16").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c17").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21'width='100%' nowrap>İçerik Servisleri</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c17").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c18").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Yurtdışına Kullanım</strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c18").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c19").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Telefon Görüşmeleri</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c19").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c20").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>SMS</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c20").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c21").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Telefon Görüşmeleri</strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c21").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c22").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Gelen Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c22").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c23").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Yapılan Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right'  width='100%' > " + dt.Rows(0)("c23").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c24").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>SMS</strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c24").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c25").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İnternet</strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c25").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If

            If dt.Rows(0)("c30").ToString() <> "X" Then
                lblKulUcret.Text = dt.Rows(0)("c30").ToString()
            End If
            If dt.Rows(0)("c31").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Telefon Görüşmeleri </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c31").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c32").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c32").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c33").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Kısa Numara </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c33").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c34").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş) </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c34").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c35").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c35").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c36").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İnternet</strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c36").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c37").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%'  nowrap><strong>SMS/ MMS/ İçerik Servisleri </strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c37").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c38").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21'width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c38").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c38").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c38").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c39").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat(Ev-İş) </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c39").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c40").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c40").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c41").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c41").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c42").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş) </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c42").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If

            If dt.Rows(0)("c43").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c43").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c44").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>İçerik Servisleri </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c44").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c45").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Yurt Dışına Kullanım </Strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c44").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c46").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Telefon Görüşmeleri </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c46").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c47").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>SMS </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c47").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c48").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Telefon Görüşmeleri </strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c48").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c49").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Gelen Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c49").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c50").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Yapılan Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("c50").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c51").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>SMS</strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c51").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("c52").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İNTERNET</strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("c52").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If


            KullanimUcretleri.InnerHtml += "</table>"


            If dt.Rows(0)("c62").ToString() <> "X" Then

                LblVergiNo.Text = dt.Rows(0)("c62").ToString().Substring(3, dt.Rows(0)("c62").ToString().Length - 3)


            End If
            Dim str() As String
            Dim str2() As String
            Dim str3() As String
            Dim str4() As String
            Dim discount As String
            Dim disclbl As String
            Dim index2 As Integer
            Dim disc() As String
            Dim k, l As Integer

            indirimler.InnerHtml = "<table>"
            If dt.Rows(0)("c26").ToString() <> "X" Then
                lblind.Text = dt.Rows(0)("c26").ToString()
            End If
            Try
                If dt.Rows(0)("c27").ToString() <> "X" Then
                    str = dt.Rows(0)("c27").ToString().Split("/")
                    str2 = dt.Rows(0)("c28").ToString().Split("/")
                    For index2 = 1 To str.Length - 1
                        discount = ""
                        indirimler.InnerHtml += "<tr>"
                        indirimler.InnerHtml += "<td class='auto-style21' nowrap>" + str(index2) + "</td>"
                        indirimler.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + str2(index2) + "</td>"
                        indirimler.InnerHtml += "</tr>"
                    Next



                End If
            Catch ex As Exception
                Response.Write(ex.ToString())
            End Try

            indirimler.InnerHtml += "</table>"


            If dt.Rows(0)("c26").ToString() <> "X" Then
                lblind.Text = dt.Rows(0)("c26").ToString()
            End If

            If dt.Rows(0)("c54").ToString() <> "X" Then
                lblAylikUcret.Text = dt.Rows(0)("c54").ToString()
            End If
            aylikucret.InnerHtml = "<table>"
            Try
                If dt.Rows(0)("c55").ToString() <> "X" Then
                    str3 = dt.Rows(0)("c55").ToString().Split("/")
                    str4 = dt.Rows(0)("c56").ToString().Split("/")
                    For index2 = 1 To str3.Length - 1
                        aylikucret.InnerHtml += "<tr>"
                        aylikucret.InnerHtml += "<td class='auto-style21' nowrap>" + str3(index2) + "</td>"
                        aylikucret.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + str4(index2) + "</td>"
                        aylikucret.InnerHtml += "</tr>"
                    Next
                End If
            Catch ex As Exception
                Response.Write(ex.ToString())
            End Try
            aylikucret.InnerHtml += "</table>"

            LblTutar.Text = dt.Rows(0)("c57").ToString()
            LblTarife.Text = dt.Rows(0)("c58").ToString()
            lblOncekiay.Text = dt.Rows(0)("c59").ToString()
            lblInvoice.Text = LblTutar.Text
            lblInvoiceAmount.Text = LblTutar.Text
            lblFaturaTarihi.Text = dt.Rows(0)("c61").ToString() + "(" + dt.Rows(0)("c60").ToString() + "-" + dt.Rows(0)("c61").ToString() + ")"

            If lblind.Text = "" Then
                lblind.Text = "0,00"
            End If
            If lblDigerUcret.Text = "" Then
                lblDigerUcret.Text = "0,00"
            End If
            If lblKulUcret.Text = "" Then
                lblKulUcret.Text = "0,00"
            End If
            If lblAylikUcret.Text = "" Then
                lblAylikUcret.Text = "0,00"
            End If




        Else
            Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Dge Output Bulunamamıştır.');</script>")
        End If
    End Sub
    Sub printlaInvoiceLayout()

       
        Dim dt As DataTable = LA_BGH_LAYOUT_ix(directory, filename)
        If dt.Rows.Count > 0 Then
           
            If dt.Rows(0)("l2").ToString() <> "X" Then
                LblMsisdn.Text = dt.Rows(0)("l2").ToString()
            End If

            If dt.Rows(0)("l3").ToString() <> "X" And dt.Rows(0)("l4").ToString() <> "X" Then
                lblFaturaTarihi.Text = dt.Rows(0)("l4").ToString() + "(" + dt.Rows(0)("l3").ToString() + "-" + dt.Rows(0)("l4").ToString() + ")"
            End If
            If dt.Rows(0)("l5").ToString() <> "X" Then
                LblTutar.Text = dt.Rows(0)("l5").ToString()
                lblInvoiceAmount.Text = LblTutar.Text
                lblInvoice.Text = LblTutar.Text

            End If
            If dt.Rows(0)("l6").ToString() <> "X" Then
                LblTarife.Text = dt.Rows(0)("l6").ToString()
            End If
            If dt.Rows(0)("l7").ToString() <> "X" Then
                lblOncekiay.Text = dt.Rows(0)("l7").ToString()
            End If
            If dt.Rows(0)("l8").ToString() <> "X" Then
                lblAylikUcret.Text = dt.Rows(0)("l8").ToString()
            End If
            aylikucret.InnerHtml = "<table>"
            Dim str3() As String
            Dim str4() As String
            Dim index2 As Integer
            Try
                If dt.Rows(0)("l9").ToString() <> "X" Then
                    str3 = dt.Rows(0)("l9").ToString().Split("/")
                    str4 = dt.Rows(0)("l10").ToString().Split("/")
                    For index2 = 1 To str3.Length - 1
                        aylikucret.InnerHtml += "<tr>"
                        aylikucret.InnerHtml += "<td class='auto-style21' nowrap>" + str3(index2) + "</td>"
                        aylikucret.InnerHtml += "<td class='auto-style13' style='text-align:right'>" + str4(index2) + "</td>"
                        aylikucret.InnerHtml += "</tr>"
                    Next
                End If
            Catch ex As Exception

            End Try
            aylikucret.InnerHtml += "</table>"
            If dt.Rows(0)("l11").ToString() <> "X" Then
                lblKulUcret.Text = dt.Rows(0)("l11").ToString()
            End If


            KullanimUcretleri.InnerHtml = "<table>"

            If dt.Rows(0)("l12").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap ><strong>Telefon Görüşmeleri </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("l12").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l62").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap >Aveaiçi</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'>" + dt.Rows(0)("l62").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l63").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap >Kısa Numara</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'>" + dt.Rows(0)("l63").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l64").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap >Sabit Hat (Ev-İş)</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'>" + dt.Rows(0)("l64").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l13").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'>" + dt.Rows(0)("l13").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l65").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İnternet </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("l65").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If

            If dt.Rows(0)("l14").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>SMS / MMS / Katma Değerli Servisler </strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("l14").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If


            If dt.Rows(0)("l15").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l15").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l66").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş) </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l66").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If


            If dt.Rows(0)("l16").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l16").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l67").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Aveaiçi</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l67").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l68").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Sabit Hat (Ev-İş)</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l68").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l69").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Diğer Operatör</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l69").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l70").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>İçerik Servisleri</td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l70").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If

            If dt.Rows(0)("l17").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Yurt Dışına Kullanım </Strong></td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%'><strong>" + dt.Rows(0)("l17").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If

            If dt.Rows(0)("l18").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Telefon Görüşmeleri </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l18").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l71").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>SMS </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l71").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l72").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>Telefon Görüşmeleri</Strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' ><strong> " + dt.Rows(0)("l72").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l73").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Gelen Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l73").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l74").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap>Yapılan Arama </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + dt.Rows(0)("l74").ToString() + "</td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l75").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>SMS</strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' ><strong> " + dt.Rows(0)("l75").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If
            If dt.Rows(0)("l76").ToString() <> "X" Then
                KullanimUcretleri.InnerHtml += "<tr>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style21' width='100%' nowrap><strong>İnternet</strong> </td>"
                KullanimUcretleri.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' ><strong> " + dt.Rows(0)("l76").ToString() + "</strong></td>"
                KullanimUcretleri.InnerHtml += "</tr>"
            End If



            KullanimUcretleri.InnerHtml += "</table>"

            If dt.Rows(0)("l19").ToString() <> "X" Then
               
                lblDigerUcret.Text = dt.Rows(0)("l19").ToString()


            End If
            If dt.Rows(0)("l35").ToString() <> "X" Then

                LblVergiNo.Text = dt.Rows(0)("l35").ToString().Substring(3, dt.Rows(0)("l35").ToString().Length - 3)


            End If

            If dt.Rows(0)("l32").ToString() <> "X" Then
                lblind.Text = dt.Rows(0)("l32").ToString()
                Dim indirimad() As String = dt.Rows(0)("l33").ToString().Split("/")
                Dim indirimfiyat() As String = dt.Rows(0)("l34").ToString().Split("/")
                Dim indirim_index As Integer
                indirimler.InnerHtml = "<table>"
                For indirim_index = 1 To indirimad.Length - 1
                    indirimler.InnerHtml += "<tr><td class='auto-style21' width='100%' nowrap>" + indirimad(indirim_index) + "</td><td class='auto-style13' style='text-align:right' width='100%'>" + indirimfiyat(indirim_index) + "</td></tr>"
                Next
                indirimler.InnerHtml += "</table>"



            End If


            digerucretler.InnerHtml = "<table>"
            Dim diger() As String
            Dim digeramount() As String
            Dim g As Integer
            If dt.Rows(0)("l20").ToString() <> "X" Then
                diger = dt.Rows(0)("l20").ToString().Split("/")
                digeramount = dt.Rows(0)("l21").ToString().Split("/")

                For g = 1 To diger.Length - 1
                    digerucretler.InnerHtml += "<tr>"
                    digerucretler.InnerHtml += "<td class='auto-style21' width='100%' nowrap>" + diger(g) + "</td>"
                    digerucretler.InnerHtml += "<td class='auto-style13' style='text-align:right' width='100%' > " + digeramount(g) + "</td>"
                    digerucretler.InnerHtml += "</tr>"
                Next

              
            End If




            digerucretler.InnerHtml += "</table>"
            If lblDigerUcret.Text = "" Then
                lblDigerUcret.Text = "0,00"
            End If

            faturaayrinti.InnerHtml = "<br/><br/>"
            Dim ft As Integer
            Dim strdetay() As String = dt.Rows(0)("l22").ToString().Split("/")
            Dim straylikucret() As String = dt.Rows(0)("l23").ToString().Split("/")
            Dim straylikdetay() As String = dt.Rows(0)("l24").ToString().Split("#")
            Dim straylik() As String = dt.Rows(0)("l25").ToString().Split("#")

            Dim indirim() As String = dt.Rows(0)("l38").ToString().Split("#")
            Dim indirimdetey() As String = dt.Rows(0)("l39").ToString().Split("#")

            Dim strkullanimucreti() As String = dt.Rows(0)("l26").ToString().Split("/")
            Dim strindirimucreti() As String = dt.Rows(0)("l27").ToString().Split("/")
            Dim faturadonemi As String = dt.Rows(0)("l28").ToString()
            Dim vergi() As String = dt.Rows(0)("l29").ToString().Split("/")
            Dim toplamtutar() As String = dt.Rows(0)("l31").ToString().Split("/")
            Dim kas() As String = dt.Rows(0)("l36").ToString().Split("/")
            Dim kia() As String = dt.Rows(0)("l37").ToString().Split("/")
            Dim kdv() As String = dt.Rows(0)("l30").ToString().Split("/")
            Dim oiv() As String = dt.Rows(0)("l40").ToString().Split("/")
            Dim ovi() As String = dt.Rows(0)("l41").ToString().Split("/")
            Dim kat() As String = dt.Rows(0)("l42").ToString().Split("/")
            Dim kta() As String = dt.Rows(0)("l43").ToString().Split("/")
            Dim ktb() As String = dt.Rows(0)("l44").ToString().Split("/")
            Dim ktc() As String = dt.Rows(0)("l45").ToString().Split("/")
            Dim ktd() As String = dt.Rows(0)("l46").ToString().Split("/")
            Dim kai() As String = dt.Rows(0)("l47").ToString().Split("/")
            Dim ksa() As String = dt.Rows(0)("l48").ToString().Split("/")
            Dim ksb() As String = dt.Rows(0)("l49").ToString().Split("/")
            Dim ksc() As String = dt.Rows(0)("l50").ToString().Split("/")
            Dim kma() As String = dt.Rows(0)("l51").ToString().Split("/")
            Dim kmb() As String = dt.Rows(0)("l52").ToString().Split("/")
            Dim kmc() As String = dt.Rows(0)("l53").ToString().Split("/")
            Dim knt() As String = dt.Rows(0)("l54").ToString().Split("/")
            Dim kna() As String = dt.Rows(0)("l55").ToString().Split("/")
            Dim knb() As String = dt.Rows(0)("l56").ToString().Split("/")
            Dim koa() As String = dt.Rows(0)("l57").ToString().Split("/")
            Dim kaa() As String = dt.Rows(0)("l58").ToString().Split("/")
            Dim kab() As String = dt.Rows(0)("l59").ToString().Split("/")
            Dim kos() As String = dt.Rows(0)("l60").ToString().Split("/")
            Dim koi() As String = dt.Rows(0)("l61").ToString().Split("/")


            Dim aylikucret2 As Double
            Dim kullanimucret As Double
            Dim h As Integer
            Dim s As Integer
            Dim baslangic As Integer = 0
            Dim kontol As Double = 0.0
            Dim kontrol2 As Double = 0.0
            Dim adim As Integer = 1
            Dim adim2 As Integer = 1
            Dim aylikucretcontrol As Integer = 0

            Dim temp() As String
            Dim temp2() As String
            Dim temp3() As String
            Dim temp4() As String

            Dim df As Integer
            Dim aylikindex As Integer
            Dim aylikstop As Integer = 0
            Dim r As Integer
            Dim fd As Integer = 1

            'Dim index34 As Integer
            'For index34 = 0 To indirim.Length
            '    Response.Write(indirim(index34) + "<br/>")

            'Next


            ' Response.Write(dt.Rows(0)("l38").ToString())

            'Response.Write("toplam tutar:" + toplamtutar.Length + "Telefon no : " + strdetay.Length)

            Try
                For aylikindex = 0 To strdetay.Length - 2
                    faturaayrinti.InnerHtml += "<table style='border:solid;rgba(0,0,0,1) thin; width:100%'><tr><td colspan='2'><strong>Fatura Ayrintilari</strong></td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td colspan='2'><strong>Sirket Adi/Adresi</strong></td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td colspan='2'>" + LblName.Text + "<br/>" + LblAdres.Text + "</td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td colspan='2'><strong>Fatura Dönemi </strong></td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td colspan='2'>" + faturadonemi.Substring(3, faturadonemi.Length - 3) + " </td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td><strong>Telefon No</strong></td><td>" + strdetay(fd) + "</td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td><strong>Musteri No</strong></td><td>" + dt.Rows(0)("l3").ToString() + dt.Rows(0)("l4").ToString() + "</td></tr>"
                    If straylikucret(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td><strong>Aylik Ucretler</strong></td><td>" + " " + "</td></tr>"
                    Else
                        faturaayrinti.InnerHtml += "<tr><td><strong>Aylik Ucretler</strong></td><td>" + straylikucret(fd) + "</td></tr>"
                        aylikucretcontrol = 1

                    End If

                    temp = straylik(aylikindex).Split("/")
                    temp2 = straylikdetay(aylikindex).Split("/")
                    For h = 1 To temp.Length - 1
                        If temp(h) = "BOS" Then
                        Else
                            faturaayrinti.InnerHtml += "<tr><td>" + temp(h) + "</td><td>" + temp2(h) + "</td></tr>"
                        End If


                    Next
                    If strkullanimucreti(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td><strong>Kullanim Ucretler</strong></td><td></td></tr>"
                    Else
                        faturaayrinti.InnerHtml += "<tr><td><strong>Kullanim Ucretler</strong></td><td>" + strkullanimucreti(fd) + "</td></tr>"
                        If kat(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>Telefon Görüşmeleri</strong></td><td>" + kat(fd) + "</td></tr>"
                        End If
                        If kta(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Aveaiçi</td><td>" + kta(fd) + "</td></tr>"
                        End If
                        If ktb(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Kısa Numara </td><td>" + ktb(fd) + "</td></tr>"
                        End If
                        If ktc(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Sabit Hat (Ev-İş)</td><td>" + ktc(fd) + "</td></tr>"
                        End If
                        If ktd(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Diğer Operatör</td><td>" + ktd(fd) + "</td></tr>"
                        End If
                        If kai(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>İnternet</strong></td><td>" + kai(fd) + "</td></tr>"
                        End If
                        If kas(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>SMS / MMS / Katma Değerli Servisler</strong></td><td>" + kas(fd) + "</td></tr>"
                        End If
                        If ksa(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Aveaiçi</td><td>" + ksa(fd) + "</td></tr>"
                        End If
                        If ksb(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Sabit Hat (Ev - İş)</td><td>" + ksb(fd) + "</td></tr>"
                        End If
                        If ksc(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Diğer Operatör</td><td>" + ksc(fd) + "</td></tr>"
                        End If
                        If kma(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Aveaiçi</td><td>" + kma(fd) + "</td></tr>"
                        End If
                        If kmb(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Sabit Hat (Ev -İş)</td><td>" + kmb(fd) + "</td></tr>"
                        End If
                        If kmc(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Diğer Operatör</td><td>" + kmc(fd) + "</td></tr>"
                        End If
                        If kia(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>İçerik Servisleri</td><td>" + kia(fd) + "</td></tr>"
                        End If
                        If knt(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>Yurtdışına Kullanım</strong></td><td>" + knt(fd) + "</td></tr>"
                        End If
                        If kna(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Telefon Görüşmeleri</td><td>" + kna(fd) + "</td></tr>"
                        End If
                        If knb(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>SMS</td><td>" + knb(fd) + "</td></tr>"
                        End If
                        If koa(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>Telefon Görüşmeleri</strong></td><td>" + koa(fd) + "</td></tr>"
                        End If
                        If kaa(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Gelen Arama</td><td>" + kaa(fd) + "</td></tr>"
                        End If
                        If kab(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td>Yapılan Arama</td><td>" + kab(fd) + "</td></tr>"
                        End If
                        If kos(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>SMS</strong></td><td>" + kos(fd) + "</td></tr>"
                        End If
                        If koi(fd) <> "BOS" Then
                            faturaayrinti.InnerHtml += "<tr><td><strong>İnternet</strong></td><td>" + koi(fd) + "</td></tr>"
                        End If

                    End If







                    If strindirimucreti(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td colspan='2'><strong>Indirimler</strong></td></tr>"
                    Else
                        faturaayrinti.InnerHtml += "<tr><td><strong>Indirimler</strong></td><td>" + strindirimucreti(fd) + "</td></tr>"

                    End If

                    temp3 = indirim(aylikindex).Split("/")
                    temp4 = indirimdetey(aylikindex).Split("/")

                    For h = 1 To temp3.Length - 1
                        If temp3(h) = "" Then
                        Else
                            faturaayrinti.InnerHtml += "<tr><td>" + temp3(h) + "</td><td>" + temp4(h) + "</td></tr>"
                        End If


                    Next



                    faturaayrinti.InnerHtml += "<tr><td colspan='2'><strong>Devlete Odenen Vergiler</strong></td></tr>"
                    If dt.Rows(0)("l29").ToString() <> "X" Then
                        faturaayrinti.InnerHtml += "<tr><td>Telsiz Kullanma Ucreti</td><td>" + vergi(h) + "</td></tr>"
                    End If

                    If kdv(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td>KDV (18%)</td><td>" + "0,00" + "</td></tr>"
                    Else

                        faturaayrinti.InnerHtml += "<tr><td>KDV (18%)</td><td>" + kdv(fd) + "</td></tr>"
                    End If

                    If oiv(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td>Özel İletişim Vergisi (25%)</td><td>" + "0,00" + "</td></tr>"
                    Else
                        faturaayrinti.InnerHtml += "<tr><td>Özel İletişim Vergisi (25%)</td><td>" + oiv(fd) + "</td></tr>"

                    End If
                    If ovi(fd) = "BOS" Then
                        faturaayrinti.InnerHtml += "<tr><td>Özel İletişim Vergisi (5%)</td><td>" + "0,00" + "</td></tr>"
                    Else
                        faturaayrinti.InnerHtml += "<tr><td>Özel İletişim Vergisi (5%)</td><td>" + ovi(fd) + "</td></tr>"
                    End If



                    'faturaayrinti.InnerHtml += "<tr><td><strong></strong></td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td><strong>Toplam  Tutar </strong></td><td>" + toplamtutar(fd) + "</td></tr>"
                    faturaayrinti.InnerHtml += "<tr><td colspan='2'><strong>Tarife Plani:</strong></td><td></td></tr>"
                    fd = fd + 1
                    faturaayrinti.InnerHtml += "</table><br/><br/>"
                Next
            Catch ex As Exception
                Response.Write(ex.ToString())
            End Try
           
           


        Else
            Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Dge Output Bulunamamıştır.');</script>")
            Response.Write(directory)
            Response.Write("<br/>" + filename)
        End If
    End Sub





End Class




